﻿@model BrnMall.Web.StoreAdmin.Models.EditProductModel

@section header{
    <title>编辑商品</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/content/css/site.css"/>
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_store/content/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="/admin_store/content/ueditor/ueditor.all.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.unobtrusive.js"></script>
    <link type="text/css" href="/admin_store/content/jbox/Skins/Default/jbox.css" rel="stylesheet" />
    <script type="text/javascript" src="/admin_store/content/jbox/jquery.jBox-2.3.min.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/selectlist.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/product.js"></script>
    <script type="text/javascript">
        productPageType=1;
        pid=@ViewData["pid"];

        @{
            StringBuilder productAttributeListStr = new StringBuilder();
            List<ProductAttributeInfo> productAttributeList = (List<ProductAttributeInfo>)ViewData["productAttributeList"];
            if(productAttributeList.Count>0)
            {
                productAttributeListStr.Append("[");
                foreach (ProductAttributeInfo info in productAttributeList)
                {
                    productAttributeListStr.AppendFormat("{0}'attrId':'{1}','attrValueId':'{2}','inputValue':'{3}'{4},", "{", info.AttrId, info.AttrValueId, info.InputValue, "}");
                }
                productAttributeListStr.Remove(productAttributeListStr.Length - 1, 1);
                productAttributeListStr.Append("]");
            }
            else
            {
                productAttributeListStr.Append("null");
            }
             
         }
       //商品属性列表
       productAttributeList = @Html.Raw(productAttributeListStr.ToString()); 
    </script>
}
@section body{
    <h1 class="rightH1">
        商品管理 &gt;&gt; 编辑商品
        <div class="right">
            <a href="@Html.Raw(ViewData["referer"].ToString())" class="menuBT">
                <img src="/admin_store/content/images/goback.jpg" />返回列表</a>
            <div class="clear">
            </div>
        </div>
        <div class="clear">
        </div>
    </h1>
    <ul class="addTag">
        <li class="hot"><a href="javascript:;">基本信息</a></li>
        <li><a href="javascript:;">属性信息</a></li>
        <li><a href="javascript:;">规格信息</a></li>
        <li><a href="javascript:;">辅助信息</a></li>
        <li><a href="javascript:;">详细描述</a></li>
        <div class="clear"></div>
    </ul>
    @using (Html.BeginForm())
    {
        <div class="addTable">
            <table width="100%">
                <tr>
                    <td width="94px" align="right">
                        商品名称：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.ProductName, new { @class = "input", size = "80" })
                        @Html.ValidationMessageFor(x => x.ProductName)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        商品货号：
                    </td>
                    <td>@Html.TextBoxFor(x => x.PSN, new { @class = "input", size = "35" })
                        @Html.ValidationMessageFor(x => x.PSN)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        商品分类：
                    </td>
                    <td>
                        <input type="text" disabled="disabled" value="@ViewData["categoryName"]" />
                        <input type="hidden" id="CateId" name="CateId" value="@ViewData["cateId"]" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        商品品牌：
                    </td>
                    <td>
                        <div class="selectBt">
                            <input type="button" value="@Model.BrandName" onclick="openBrandSelectLayer(this)" />
                            <input type="hidden" class="BrandId" id="BrandId" name="BrandId" value="@Model.BrandId" />
                            <input type="hidden" class="BrandName" id="BrandName" name="BrandName" value="@Model.BrandName"/>
                        </div>
                        @Html.ValidationMessageFor(x => x.BrandId)
                    </td>
                </tr>
                <tr>
                    <td width="76px;" align="right">
                        店铺分类：
                   </td>
                    <td>@Html.DropDownListFor(x => x.StoreCid, ViewData["storeClassList"] as List<SelectListItem>) @Html.ValidationMessageFor(x => x.StoreCid)</td>
                </tr>
                <tr>
                <td width="76px;" align="right">
                    配送模板：
                </td>
                <td>@Html.DropDownListFor(x => x.StoreSTid, ViewData["storeShipTemplateList"] as List<SelectListItem>) @Html.ValidationMessageFor(x => x.StoreSTid)</td>
                </tr>
                <tr>
                    <td align="right">
                        成本价：
                    </td>
                    <td>@Html.TextBoxFor(x => x.CostPrice, new { @class = "input", size = "10" })元 @Html.ValidationMessageFor(x => x.CostPrice)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        市场价：
                    </td>
                    <td>@Html.TextBoxFor(x => x.MarketPrice, new { @class = "input", size = "10" })元 @Html.ValidationMessageFor(x => x.MarketPrice)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        本店价：
                    </td>
                    <td>@Html.TextBoxFor(x => x.ShopPrice, new { @class = "input", size = "10" })元 @Html.ValidationMessageFor(x => x.ShopPrice)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        <a href="" class="addBt submit">
                            <img src="/admin_store/content/images/submit.jpg" /></a>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>

        <div class="addTable hide">
            <table width="100%" id="commonAttributeTable">
                <tr>
                    <td width="100px;" align="right">系统错误</td>
                    <td></td>
                </tr>
                <tr class="keepTr">
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        <a href="" class="addBt submit">
                            <img src="/admin_store/content/images/submit.jpg" /></a>
                    </td>
                </tr>
                <tr class="keepTr">
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>
        
        <div class="addTable hide">
            <table width="100%">
                @{
                    DataTable productSKUItemList = (DataTable)ViewData["productSKUItemList"];
                    if (productSKUItemList == null || productSKUItemList.Rows.Count < 1)
                    {
                        <tr>
                            <td width="110px;" align="right">此商品没有规格</td>
                            <td></td>
                        </tr>
                    }
                    else
                    {
                        foreach (DataRow row in productSKUItemList.Rows)
                        {
                            <tr>
                                <td width="76px;" align="right">@row["attrname"]:</td>
                                <td>
                                @{
                                    if (row["attrvalueid"].ToString()=="0")
                                    {
                                        @row["inputvalue"]
                                    }
                                    else
                                    {
                                        @row["attrvalue"]
                                    }
                                 }
                                </td>
                            </tr>
                        }
                    }
                    }

                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        <a href="" class="addBt submit">
                            <img src="/admin_store/content/images/submit.jpg" /></a>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>
        
        <div class="addTable hide">
            <table width="100%">
                <tr>
                    <td width="84px" align="right">
                        重量：
                    </td>
                    <td>@Html.TextBoxFor(x => x.Weight, new { @class = "input", size = "10" })克
                        @Html.ValidationMessageFor(x => x.Weight)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        排序：
                    </td>
                    <td>@Html.TextBoxFor(x => x.DisplayOrder, new { @class = "input", size = "10" })
                        @Html.ValidationMessageFor(x => x.DisplayOrder)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        库存数量：
                    </td>
                    <td>@Html.TextBoxFor(x => x.StockNumber, new { @class = "input", size = "10" })
                        @Html.ValidationMessageFor(x => x.StockNumber)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        库存警戒线：
                    </td>
                    <td>@Html.TextBoxFor(x => x.StockLimit, new { @class = "input", size = "10" })
                        @Html.ValidationMessageFor(x => x.StockLimit)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        是否上架：
                    </td>
                    <td>
                        <p>
                            <label>@Html.RadioButtonFor(x => x.State, 0, new { @class = "checkbox" })是</label>
                            <label>@Html.RadioButtonFor(x => x.State, 1, new { @class = "checkbox" })否</label>
                            <br />
                        </p>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        商品标签：
                    </td>
                    <td>
                        <p>
                            <label>@Html.CheckBoxFor(x => x.IsHot, new { @class = "checkbox" })热销</label>
                            <label>@Html.CheckBoxFor(x => x.IsBest, new { @class = "checkbox" })精品</label>
                            <label>@Html.CheckBoxFor(x => x.IsNew, new { @class = "checkbox" })新品</label>
                            <br />
                        </p>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        <a href="" class="addBt submit">
                            <img src="/admin_store/content/images/submit.jpg" /></a>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>
    
        <div class="addTable hide">
            <table width="100%">
                <tr>
                    <td width="0px" align="right">
                        <div style="margin-left: 15px;">
                        </div>
                    </td>
                    <td>
                        <div style="margin-top: 5px;">
                        </div>
                         <script name="Description" id="bmaEditor" type="text/plain">@Html.Raw(Model.Description)</script>
                         <script type="text/javascript">
                             UE.Editor.prototype.getActionUrl = function (action) {
                                 if (action == "config") {
                                     return "@WorkContext.MallConfig.UploadServer/storeadmin/tool/upload?operation=ueconfig";
                                 } else {
                                     return "@WorkContext.MallConfig.UploadServer/storeadmin/tool/upload?operation=uploadproducteditorimage";
                                 }
                             }
                             UE.getEditor('bmaEditor');
                        </script>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        <a href="" class="addBt submit">
                            <img src="/admin_store/content/images/submit.jpg" /></a>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </div>
        
    }
}
